
require(['select2', 'date','validator','jquery-form'], function() {
	var $formData = $('#formData');
	$formData.initForm();

	add = function(fn) {
		addOrUpdate("/upgrade/addStatusMgr.htm",fn);
	};

	function addOrUpdate(url,callBack){
		var result = $.validator($formData);
		if(result){
			var params = [];
			$formData.find('input[name="paramName"]').each(function(i,item){
				params.push({
					name  : "list["+ i + "].paramName",
					value : $(this).attr("id")
				});
				params.push({
					name  : "list["+ i + "].paramValue",
					value : $(this).val()
				});
				params.push({
					name  : "list["+ i + "].sn",
					value : i
				});
			});
			params.push({
				name  : "lineId",
				value : commonFun.getLeftTreeSelectedNodes()[0].id
			},{
				name  : "vrsnName",
				value : $("#vrsnName").val()
			},{
				name  : "remark",
				value :  $("#remark").val()
			},{
				name  : "vrsnType",
				value : "VERS0005"
			});
			$.ajaxExt({
				url : url,
				data : params
			}).done(function(){
				callBack();
			});
		}
	}

});